package com.vf.cloud.scene.mvc.ue.controller;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.vf.cloud.common.util.R;
import com.vf.cloud.scene.common.domain.Poi;
import com.vf.cloud.scene.common.vo.ue.poi.POIForUE;
import com.vf.cloud.scene.mvc.ue.service.IPOIService;

@RestController
@RequestMapping("/scene/ue/poi")
public class POIController {

	@Autowired
	private IPOIService iPOIService;

	@GetMapping("/list")
	public R<List<POIForUE>> findList(@RequestParam(name = "identify", required = false) String identify) {
		return iPOIService.findList(identify);
	}

	@GetMapping("/findById")
	public R<POIForUE> findById(@RequestParam(name = "id", required = false) String id) {
		Poi poi = Poi.dao.findById(id);
		if (poi == null) {
			return R.failed();
		}
		POIForUE poiForUE = new POIForUE();
		poiForUE.setId(poi.getId());
		poiForUE.setCoord_type(poi.getCoordType());
		poiForUE.setCoord(poi.getCnText());
		return R.ok();
	}

}
